package com.david.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.UUID;

/**
 * @Description: PaymentController
 * @Author: wangwei
 * @CreateDate: 2022/1/13 11:04
 */
@RestController
public class PaymentController {


    @Value("${server.port}")
    private  String serverPort;

    @Resource
    private RestTemplate restTemplate;


    private static final String  url="http://cloud-payment-provider";
    @GetMapping("/consumer/payment/consul")
    public String paymentConsul(){
        return restTemplate.getForObject(url+"/payment/consul",String.class);
    }

    public String paymentConsulHandler(){

        return "paymentConsulHandler with consul:"+serverPort+"  >> "+ UUID.randomUUID().toString();
    }
}

